feat(agentex-ui): grow chat input vertically for multi-line prompts#332
Open
declan-scale wants to merge 2 commits into
Open
feat(agentex-ui): grow chat input vertically for multi-line prompts#332declan-scale wants to merge 2 commits into
declan-scale wants to merge 2 commits into
Conversation
The plain-text prompt was a single-line input, so long messages scrolled horizontally and users couldn't review what they had typed. Swap it for a textarea that auto-grows up to 200px (matching the JSON / CodeMirror cap), then scrolls internally. Align the surrounding row to items-end so the send button stays anchored to the bottom as the input grows. Enter sends; Shift+Enter inserts a newline. Refs: AGX1-386
danielmillerp
approved these changes
Jun 22, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The plain-text prompt input in the golden agent UI (
agentex-ui/components/primary-content/prompt-input.tsx) is an<input type="text">. Longer messages scroll horizontally inside the single line, so authors of multi-line prompts (lists, code snippets, paragraphs) can't see what they've typed or edit it comfortably before sending. Prompt quality directly affects agent output, so the friction matters.Fix
Swap the plain-text input for an auto-growing
<textarea>in the same component. The JSON / CodeMirror branch already grows vertically up to200px— use the same cap on the text branch so the two variants feel consistent.Specifically:
<input type="text">with<textarea rows={1}>in theTextInputsubcomponent.auto, then setheight = min(scrollHeight, 200px); toggleoverflow-ytoautoonce the cap is hit so it scrolls internally.items-centertoitems-endso thesize-10send button stays anchored at the bottom of the row as the textarea grows.py-2 leading-6so the single-line natural height (8 + 24 + 8 = 40px) matches the send button height — preserves today's container height and the visual centering of short messages.resize-noneand capmaxHeightinline so the user can't drag-resize past the cap.textInputRefandTextInput'sinputRefprop type fromHTMLInputElementtoHTMLTextAreaElement.Keyboard behavior
preventDefaultin that case).e.nativeEvent.isComposing) so CJK candidate selection isn't hijacked.The JSON branch continues to use
Cmd/Ctrl+Enter(Mod-Enter) to send — that path is unchanged.Out of scope (matches the issue)
Validation
Local validation was skipped per agent policy — relying on CI for typecheck/lint/format. The pinned prettier is
3.x; only2.8is available on PATH in this environment, so I did not auto-format (mixing prettier majors causes unrelated reformatting). The diff matches the file's existing style.Reviewer test plan
~200px; the textarea stops growing and scrolls internally.cursor-not-allowed.Linear
AGX1-386
Greptile Summary
This PR swaps the single-line
<input type="text">in theTextInputsub-component for an auto-growing<textarea>capped at 200 px, matching the JSON/CodeMirror branch's existing cap. The flex container alignment is updated fromitems-centertoitems-endso the send button stays bottom-anchored as the textarea grows, andpy-2 leading-6keeps the single-line height identical to the previous input.heightto'auto'on eachpromptchange, reads the naturalscrollHeight, clamps it to 200 px, and togglesoverflowYaccordingly.e.preventDefault()on bare Enter while Shift+Enter inserts a newline; IME composition guard prevents hijacking CJK candidate selection.HTMLInputElementtoHTMLTextAreaElementthroughout.Confidence Score: 5/5
Safe to merge — the change is isolated to a single UI sub-component and handles all stated keyboard edge-cases correctly.
The resize effect, keyboard logic, ref-type update, and flex-alignment change are all self-contained and correct. No state management, API calls, or shared utilities are affected.
No files require special attention.
Important Files Changed
<input type="text">with an auto-growing<textarea>capped at 200px; adds IME-aware Enter/Shift+Enter keyboard handling; updates ref type and flex alignment — logic is correct with only a minor style nit in the resize effect.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User types in TextInput textarea] --> B[prompt state updates] B --> C[useEffect runs auto-resize logic] C --> D[el.style.height = 'auto'] D --> E[Read el.scrollHeight] E --> F{scrollHeight > 200px?} F -- No --> G[height = scrollHeight, overflowY = hidden] F -- Yes --> H[height = 200px, overflowY = auto] A2[User presses key] --> I{Enter, no Shift, no IME?} I -- No --> J[Default browser behavior] I -- Yes --> K[e.preventDefault] K --> L{enabled AND prompt not empty?} L -- Yes --> M[handleSendPrompt, clears prompt] L -- No --> N[No-op] M --> B%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[User types in TextInput textarea] --> B[prompt state updates] B --> C[useEffect runs auto-resize logic] C --> D[el.style.height = 'auto'] D --> E[Read el.scrollHeight] E --> F{scrollHeight > 200px?} F -- No --> G[height = scrollHeight, overflowY = hidden] F -- Yes --> H[height = 200px, overflowY = auto] A2[User presses key] --> I{Enter, no Shift, no IME?} I -- No --> J[Default browser behavior] I -- Yes --> K[e.preventDefault] K --> L{enabled AND prompt not empty?} L -- Yes --> M[handleSendPrompt, clears prompt] L -- No --> N[No-op] M --> BReviews (2): Last reviewed commit: "style(agentex-ui): collapse Enter keydow..." | Re-trigger Greptile